package com.jinglin.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.jinglin.entity.enums.VideoStatusEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 视频信息
 * </p>
 *
 * @author ${author}
 * @since 2025-03-12
 */
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="VideoInfoPost对象", description="视频信息")
@Data
public class VideoInfoPost extends Model<VideoInfoPost>{

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "视频ID")
      @TableId(value = "video_id", type = IdType.ASSIGN_ID)
    private String videoId;

    @ApiModelProperty(value = "视频封面")
    private String videoCover;

    @ApiModelProperty(value = "视频名称")
    private String videoName;

    @ApiModelProperty(value = "用户ID")
    private String userId;

    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "最后更新时间")
    private LocalDateTime lastUpdateTime;

    @ApiModelProperty(value = "父级分类ID")
    private String pCategoryId;

    @ApiModelProperty(value = "分类ID")
    private String categoryId;

    @ApiModelProperty(value = "0:转码中 1转码失败 2:待审核 3:审核成功 4:审核失败")
    private Integer status;

    @ApiModelProperty(value = "0:自制作  1:转载")
    private Integer postType;

    @ApiModelProperty(value = "原资源说明")
    private String originInfo;

    @ApiModelProperty(value = "标签")
    private String tags;

    @ApiModelProperty(value = "简介")
    private String introduction;

    @ApiModelProperty(value = "互动设置")
    private String interaction;
    private String nickName;
    private String avatar;
    @TableField(exist = false)
    private Integer recommendType;

    @TableField(exist = false)
    private Integer playCount;

    @TableField(exist = false)
    private Integer likeCount;

    @TableField(exist = false)
    private Integer danmuCount;

    @TableField(exist = false)
    private Integer commentCount;

    @TableField(exist = false)
    private Integer coinCount;

    @TableField(exist = false)
    private Integer collectCount;


    @ApiModelProperty(value = "持续时间（秒）")
    private Integer duration;

    @TableField(exist = false)
    private String statusName;
    public String getStatusName(){
        VideoStatusEnum statusEnum = VideoStatusEnum.getByStatus(status);
        return statusEnum == null ? "":statusEnum.getDesc();
    }


    @ApiModelProperty(value = "删除为1 未删除为0")
    @TableLogic
    private Integer deleted;


    @Override
    protected Serializable pkVal() {
        return this.videoId;
    }

}
